package com.cp.weixin.blog.dao;

import com.cp.weixin.blog.repository.Tag;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component("tagMapper")
public interface TagMapper {

    @Select("SELECT * FROM tag")
    @Results(id = "allColumns", value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "tag", property = "tag")
    })
    List<Tag> getAll();


    @Select("SELECT * FROM tag WHERE id = #{id}")
    @ResultMap(value = "allColumns")
    Tag getById(Integer id);

}
